package org.apm.data.copy;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apm.data.bean.Parameter;

public class CopyMain {
    private static final Logger LOGGER = LogManager.getLogger(CopyMain.class);

    public static void main(String[] args) throws InterruptedException {

        if (args.length > 0 && args[0].startsWith("--help")) {
            System.out.println("\t -f|-from , the from time , should be '" + Parameter.Day_Pattern + "'\n"
                    + "\t -t|-to , the to time , should be '" + Parameter.Day_Pattern + "'\n"
                    + "\n\n###\tcopy flags, only used in copy.sh\n"
                    + "\t -type, the type of elasticsearch. should be designated. \n"
                    + "\t -mType , copy multi type, use the 'types' in properties\n"
                    + "\t -aType , copy all type, which define in code\n");
            System.exit(0);
        } else {
            Parameter parameter = new Parameter();
            parameter.parameter(args);
            LOGGER.info("[Copy] parameter: " + parameter);

            CopyData deleter = new CopyData(parameter);
            deleter.process();
            Thread.sleep(5000);
        }
    }
}
